# #!/usr/bin/env python
# # -*- encoding: utf-8 -*-
# '''
# @File    :   DTC_test.py
# @Time    :   2024/08/21 13:31:28
# @Author  :   YangLiang 
# @Version :   1.0
# @Contact :   yangliang@chengtech.com
# @License :   (C)Copyright 2022-2025
# @Desc    :   None
# '''

# # here put the import lib
# from cgitb import enable
# from email.message import Message
# from pytest_assume.plugin import assume
 
# import pytest
# import binascii
# import logging
# import time
# import requests
# from sympy import I
# from TimeSynchronization import *
# # from sympy import assuming
# from commDriver.TS_CAN import *
# import allure
# import sys
# from collections.abc import Iterable

# from sqlalchemy import false
# sys.dont_write_bytecode = True
# import Set_up

# Fault_Injection_DTC_List = [([0xAC, 0xE8, 0x76], 'SensorBlindnessDet'),
#                             ([0xAC, 0xE9, 0x76], 'SensorBlindnessDet'),
#                             ([0xAC, 0xE6, 0x55], 'VariantCodeDet'),
#                             ([0xAC, 0xD1, 0x78], 'AlignmentNeverDone'),
#                             ([0xAC, 0xD2, 0x78], 'AlignmentNotDone'),
#                             ([0xAC, 0xEA, 0x94], 'VerticalMisaligment'),
#                             ([0xAC, 0xEB, 0x94], 'HorizontalMisaligment'),
#                             ([0xAC, 0xD4, 0x88], 'FactoryDataFail'),
#                             ([0xAC, 0xD9, 0x17], 'Rd3_3OV'),
#                             ([0xAC, 0xDB, 0x16], 'Rd3_3UV'),
#                             ([0xAC, 0xDE, 0x00], 'RadarModulation'),
#                             ([0xAC, 0xE1, 0x52], 'SwTempFail'),
#                             ([0xAC, 0xE2, 0x4B], 'MasterRdTemp'),  # PASS与FAIL状态不是0与-1.需要输入具体数值
#                             ([0xAC, 0xED, 0x00], 'AntDiagram'),
#                             ([0xAC, 0xD6, 0x40], 'Watchdog'),                #内部电源管理系统故障 new
#                             ([0xAC, 0xD8, 0x04], 'internalHw'),                #内部硬件故障 new
#                             ([0xAC, 0xDD, 0x00], 'radarModCfg'),                #雷达调制配置故障 new
#                             ([0xAC, 0xDF, 0x52], 'swFail'),                #软件故障 new
#                             ([0xAC, 0xE0, 0x00], 'basebandFail'),                #雷达前端数据处理故障 new
#                             ]


# IPB_0x10C_Value = [ ('VehicleSpeed_Status', 1, 0),
#                     ('Vehicle_speed', 281.5, 80),
#                     ('AXstatus', 0, 1),
#                     ('AYstatus', 0, 1),
#                     ('AX', 22, 0),
#                     ('AY', 22, 0),
#                     ('AX_Offset', 22, 0),
#                     ('AYOffset', 22, 0),
#                     ('Yaw_Rate_Status', 0, 1),
#                     ('Yaw_Rate', 2.1, 0),
#                     ('Yaw_Rate_Offset', 0.14, 0),
#                     ('ABS_Fault', 1, 0),
#                     ('WheelSpeed_FR_Status', 1, 0),
#                     ('WheelSpeed_FL_Status', 1, 0),
#                     ('WheelSpeed_RR_Status', 1, 0),
#                     ('WheelSpeed_RL_Status', 1, 0),
#                     ('WheelSpeed_FL', 281.5, 0),
#                     ('WheelSpeed_FR', 281.5, 0),
#                     ('WheelSpeed_RL', 281.5, 0),
#                     ('WheelSpeed_RR', 281.5, 0),
#                     ('FLWheelDriveDirectionStatus', 1, 0),
#                     ('FRWheelDriveDirectionStatus', 1, 0),
#                     ('RLWheelDriveDirectionStatus', 1, 0),
#                     ('RRWheelDriveDirectionStatus', 1, 0),
#                     ('RRWheelDriveDirection', 0, 1),
#                     ('RLWheelDriveDirection', 0, 1),
#                     ('FRWheelDriveDirection', 0, 1),
#                     ('FLWheelDriveDirection', 0, 1),
#                 ]




# @allure.severity('critical')
# class Test_DTC_Phy(object):

#     def clearDTC(self, Driver, iStep,checkinitialized=True):
#         # 清除DTC故障
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 0, iStep, False, 'UDS', 'noClearFault')
#         time.sleep(2)
#         if checkinitialized:
#             iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 0, iStep, False, 'UDS', 'noClearFault')
#             iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)
#         return iStep

#     def searchDTC(self, Driver,req, DTC_Number,iStep, isTrue, MatureConditionsTime=1000, timeout=0.5):
#         # 查询故障
#         with allure.step(f"Step{iStep}: search DTC {binascii.b2a_hex(bytearray(DTC_Number), ' ')}"):
#             time.sleep(MatureConditionsTime/1000)
#             a,b,c=Driver['UDS'].search_DTC(req, DTC_Number, timeout)
#             if isTrue:
#                 if (b + MatureConditionsTime/1000) > (MatureConditionsTime/1000 + 0.15):
#                     logging.error(f"MatureConditionsTime = {MatureConditionsTime/1000 + 0.1}, realtime = {b + MatureConditionsTime/1000}")
#                 if a != True:
#                     logging.error(f"No found DTC{binascii.b2a_hex(bytearray(DTC_Number), ' ')}")
#                 with assume: assert a == True and (b + MatureConditionsTime/1000) <= (MatureConditionsTime/1000 + 0.1)
#             else:
#                 with assume: assert a == False
#             iStep +=1
#         return iStep

#     '''设置信号使能状态'''
#     def setSignalEanble(self, Driver, message, status, iStep):
#         with allure.step(f'Step{iStep}: set the {message} status to {status}'):
#             Driver['CAN'].Enable_rbs_message(Set_up.NetName,Set_up.nodeName, message, status)
#         iStep += 1
#         return iStep


#     '''设置信号值'''
#     def setSignalValue(Self, Driver, message, signal, value, iStep):
#         with allure.step(f'Step{iStep}: set the value of the {signal} in {message} to {value}'):
#             Driver['CAN'].write_db_signal(Set_up.NetName,Set_up.nodeName, message, signal, value)
#             time.sleep(0.2)
#             iStep += 1
#             readValue = Driver['CAN'].read_db_signal(Set_up.NetName,Set_up.nodeName, message, signal)
#         return iStep
            

#     def checkDTC(self, Driver, DTCNumber, message, cycleTime, missCount, iStep, signal='', faultValue=0, normalValue=0, settype='enable'):
#         req = [0x19,0x02,0x09]
#         DTC_Number_Exist = DTCNumber + [0x09]
#         DTC_Number_NoExist = DTCNumber + [0x08]
#         iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, '1001', '5001', 0, iStep)
#         iStep = self.clearDTC(Driver, iStep)
#         time.sleep(1.5)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)

#         if settype == 'enable':
#             # 停发报文
#             iStep = self.setSignalEanble(Driver,message, False,iStep)
#             if message == 'MPC_0x374':
#                 iStep = self.setSignalEanble(Driver,'MPC_0x295', False,iStep)
#                 readValue = Driver['CAN'].read_db_signal(Set_up.NetName, Set_up.nodeName, 'Left_BCM_0x12D', 'BCMPower_Gear_12D_S')
#                 readValue = Driver['CAN'].read_db_signal(Set_up.NetName,Set_up.nodeName, 'Left_BCM_0x3D9', 'Total_Distance_3D9s5_S')
#             if message == 'MPC_0x295':
#                 iStep = self.setSignalEanble(Driver,'MPC_0x374', False,iStep)
#                 readValue = Driver['CAN'].read_db_signal(Set_up.NetName,Set_up.nodeName, 'Left_BCM_0x12D', 'BCMPower_Gear_12D_S')
#                 readValue = Driver['CAN'].read_db_signal(Set_up.NetName,Set_up.nodeName, 'Left_BCM_0x3D9', 'Total_Distance_3D9s5_S')

#         else:
#             iStep = self.setSignalValue(Driver, message, signal, faultValue, iStep)
#         # 查询故障是否已经产生,应无DTC
#         iStep = self.searchDTC(Driver, req, DTC_Number_Exist, iStep, False, cycleTime * missCount + 100)
        
#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         # 查询故障是否已经产生
#         iStep = self.searchDTC(Driver, req, DTC_Number_Exist, iStep, True, cycleTime * missCount + 100)

#         if settype == 'enable':
#             # 停发报文
#             iStep = self.setSignalEanble(Driver,message, True,iStep)
#         else:
#             iStep = self.setSignalValue(Driver, message, signal, normalValue, iStep)
#         # 查询故障是否已经恢复
#         iStep = self.searchDTC(Driver, req, DTC_Number_NoExist, iStep, True, cycleTime + 100, 1)
#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number_NoExist, iStep, True, 3000, 1)
#         iStep = self.clearDTC(Driver, iStep)
#         iStep = self.searchDTC(Driver, req, DTC_Number_NoExist, iStep, False, 3000, 1)

#         return iStep

#     @allure.title('Test DTC_VBAT_HIGH in default session')
#     @allure.description('Test DTC_VBAT_HIGH in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_VBAT_HIGH_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xAC,0xCE,0x17]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)
#         iStep = self.clearDTC(Driver, iStep)
        
#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)

#         iStep = Driver['CAN'].SetVolt(Driver, 17, 0.5, iStep)
#         # 查询高压故障是否已经产生
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 1000)
#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         # 查询高压故障是否已经产生
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 1000)

#         iStep = Driver['CAN'].SetVolt(Driver, 12, 0.5, iStep)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 1000)
#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)
#         iStep = self.clearDTC(Driver, iStep)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)

#     @allure.title('Test DTC_VBAT_LOW in default session')
#     @allure.description('Test DTC_VBAT_LOW in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_VBAT_LOW_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xAC,0xCF,0x16]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)
#         iStep = self.clearDTC(Driver, iStep)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 设置电压为8v 制造低压故障
#         iStep = Driver['CAN'].SetVolt(Driver, 8, 0.5, iStep)
#         # 查询低压故障是否已经产生
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 1000)
#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         # 查询低压故障是否已经产生
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 1000)
#         # 恢复电压为13v
#         iStep = Driver['CAN'].SetVolt(Driver, 12, 0.5, iStep)
#         # 查询故障是否已经恢复
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 1000)

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)
#         iStep = self.clearDTC(Driver, iStep)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)

    
#     '''故障注入测试'''
#     ids = ["Request {0}".format(binascii.b2a_hex(bytearray(req), ' '), dtcName ) for req, dtcName in Fault_Injection_DTC_List]
#     @allure.title('Test Injection_DTC in default session')
#     @allure.description('Test Injection_DTC in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     @pytest.mark.parametrize('req,dtcName', Fault_Injection_DTC_List, ids=ids)
#     def test_Injection_DTC_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver, req, dtcName):
#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver, iStep, True)
#         iStep = Driver['CAN'].setVariantCodeDet(Driver,dtcName, -1, iStep)
#         time.sleep(0.5)
#         if req == [0xAC, 0XE8, 0X76]:
#             # 要求行驶里程大于5公里
#             Driver['CAN'].write_db_signal(Set_up.NetName, Set_up.nodeName, 'Left_BCM_0x3D9', 'Total_Distance_3D9s5_S',10)
#             Driver['CAN'].write_db_signal(Set_up.NetName, Set_up.nodeName, 'IPB_0x10C', 'Vehicle_speed', 20)
#             Driver['CAN'].read_db_signal(Set_up.NetName, Set_up.nodeName, 'IPB_0x10C', 'Vehicle_speed')
#             time.sleep(1)
#             Driver['CAN'].write_db_signal(Set_up.NetName, Set_up.nodeName, 'Left_BCM_0x3D9', 'Total_Distance_3D9s5_S',16)

#         a,b,c=Driver['UDS'].search_DTC([0x19,0x02,0x09], req + [0x09])
#         if a == True:
#             logging.info(f"found DTC{binascii.b2a_hex(bytearray(req + [0x09]), ' ')}")
#         with assume: assert a == False


#         # 设置车辆退出极限续航模式，应可以检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver, iStep, False)
#         a,b,c=Driver['UDS'].search_DTC([0x19,0x02,0x09], req + [0x09])
#         if a != True:
#             logging.error(f"No found DTC{binascii.b2a_hex(bytearray(req + [0x09]), ' ')}")
#         with assume: assert a == True

#         iStep = Driver['CAN'].setVariantCodeDet(Driver,dtcName, 0,iStep)
#         if req == [0xAC, 0XE8, 0X76]:
#             Driver['CAN'].write_db_signal(Set_up.NetName, Set_up.nodeName, 'Left_BCM_0x3D9', 'Total_Distance_3D9s5_S',0)
#             Driver['CAN'].write_db_signal(Set_up.NetName, Set_up.nodeName, 'IPB_0x10C', 'Vehicle_speed', 0)
#             Driver['CAN'].read_db_signal(Set_up.NetName, Set_up.nodeName, 'IPB_0x10C', 'Vehicle_speed')
#         time.sleep(0.5)
#         a,b,c=Driver['UDS'].search_DTC([0x19,0x02,0x09], req + [0x08])
#         if a != True:
#             logging.error(f"DTC [{binascii.b2a_hex(bytearray(req + [0x08]), ' ')}] not recovered")
#         with assume: assert a == True

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         if req == [0xAC, 0xE6, 0x55] or req == [0xAC, 0xD1, 0x78] or req == [0xAC, 0xD2, 0x78]:
#             a,b,c=Driver['UDS'].search_DTC([0x19,0x02,0x09], req + [0x08],timeout=1)
#             if a == False:
#                 a,b,c=Driver['UDS'].search_DTC([0x19,0x02,0x09], req + [0x09],timeout=1)
#         else:
#             a,b,c=Driver['UDS'].search_DTC([0x19,0x02,0x09], req + [0x08],timeout=1)
#         if a != True:
#             logging.error(f"Restart Device DTC [{binascii.b2a_hex(bytearray(req), ' ')}] is not saved")
#         with assume: assert a == True and b <= 1

#         uds_rep,size = Driver['UDS'].req_and_res_can([0x14,0xFF,0xFF,0xFF],4)
#         with assume: assert uds_rep[0] == 0x54
#         time.sleep(1.5)
#         a,b,c=Driver['UDS'].search_DTC([0x19,0x02,0x09], req + [0x08],timeout=1)
#         with assume: assert a == False

#     @allure.title('Test DTC_SFCAN_BUSOFF in default session')
#     @allure.description('Test DTC_SFCAN_BUSOFF in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_SFCAN_BUSOFF_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xC1,0xD7,0x88]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)

#         Driver['CAN'].S_ConnectCanH_CanL(True, iStep)
#         Driver['CAN'].S_ConnectCanH_CanL(False, iStep)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 300, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)

#         Driver['CAN'].S_ConnectCanH_CanL(True, iStep)
#         Driver['CAN'].S_ConnectCanH_CanL(False, iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 300, 1)
#         time.sleep(0.2)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)   
    

#     @allure.title('Test DTC_PRODUCTION_MODE_ACTIVE in default session')
#     @allure.description('Test DTC_PRODUCTION_MODE_ACTIVE in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_PRODUCTION_MODE_ACTIVE_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xAC,0xD0,0x00]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
        
#         # 更改模式为生产模式
#         with allure.step(f'Step{iStep}: set production mode is factory mode'):
#             iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, '2E340101', '6E3401', 3, iStep, True)
#             iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, '223401', '62340101', 0, iStep, False)

#         # 查询故障是否已经产生
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 1000)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)

#         # 查询故障是否已经产生
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 1000)
#         # 更改模式为正常模式
#         with allure.step(f'Step{iStep}: set production mode is normal mode'):
#             iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, '2E340100', '6E3401', 3, iStep, True)
#             iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, '223401', '62340100', 0, iStep, False)
#         # 查询故障是否已经恢复
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 1000)
#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)
        
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)
#         iStep = self.clearDTC(Driver, iStep)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)

    

    
#     @allure.title('Test DTC_Left_BCM_TIMEOUT by lost 0x12D message in default session')
#     @allure.description('Test DTC_Left_BCM_TIMEOUT by lost 0x12D message in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Left_BCM_TIMEOUT_0x12D_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xC1, 0xA8, 0x87]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'Left_BCM_0x12D', 50, 10, iStep)
    

#     @allure.title('Test DTC_Left_BCM_TIMEOU by lost 0x3D9 message in default session')
#     @allure.description('Test DTC_Left_BCM_TIMEOU by lost 0x3D9 message in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Left_BCM_TIMEOU_0x3D9_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xC1, 0xA8, 0x87]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'Left_BCM_0x3D9', 1000, 5, iStep)

#     @allure.title('Test DTC_Left_BCM_Signal_Invalid in default session')
#     @allure.description('Test DTC_Left_BCM_Signal_Invalid in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Left_BCM_Signal_Invalid_EnduranceMode_Default_Phy(self,action,Driver):
#         DTCNumber = [0x5C, 0x65, 0x86]
#         iStep = 1
#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)
#         iStep = self.checkDTC(Driver, DTCNumber, 'Left_BCM_0x3D9', 1000, 10, iStep, 'Total_Distance_3D9s5_S', 0x7FFFFFF, 0, 'value')

    
#     @allure.title('Test DTC_Rear_BCM_TIMEOUT by lost 0x218 message in default session')
#     @allure.description('Test DTC_Rear_BCM_TIMEOUT by lost 0x218 message in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Rear_BCM_TIMEOUT_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xD0, 0x03, 0x04]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'Rear_BCM_0x218', 20, 10, iStep)
    
#     @allure.title('Test DTC_Rear_BCM_CRC by 0x218 Checksum Error in default session')
#     @allure.description('Test DTC_Rear_BCM_CRC by 0x218 Checksum Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Rear_BCM_CRC_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0x5C,0x49,0x00]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障
#         Driver['CAN'].set_0x218_checksum_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 200, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         # 10次 10*20ms = 200ms
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 200, 1)

#         Driver['CAN'].set_0x218_checksum_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 20, 1)
#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)

    
#     @allure.title('Test DTC_Rear_BCM_ALC by 0x218 RollingCounter Error in default session')
#     @allure.description('Test DTC_Rear_BCM_ALC by 0x218 RollingCounter Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Rear_BCM_ALC_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0x5C,0x36,0x82]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障 
#         Driver['CAN'].set_0x218_rolling_counter_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 200, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         #10次 100ms*10=1000ms 增加一帧的延时
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 200, 1)

#         Driver['CAN'].set_0x218_rolling_counter_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 20, 1)

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)

    
#     @allure.title('Test DTC_Rear_BCM_Signal_Invalid in default session')
#     @allure.description('Test DTC_Rear_BCM_Signal_Invalid in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Rear_BCM_Signal_Invalid_EnduranceMode_Default_Phy(self,action,Driver):
#         DTCNumber = [0xD1, 0x7B, 0x86]
#         iStep = 1
#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)
#         iStep = self.checkDTC(Driver, DTCNumber, 'Rear_BCM_0x218', 20, 10, iStep, 'EPB_Status_S', 0x04, 0, 'value')


#     @allure.title('Test DTC_Media_TIMEOUT by lost 0x2B6 message in default session')
#     @allure.description('Test DTC_Media_TIMEOUT by lost 0x2B6 message in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Media_TIMEOUT_0x2B6_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xC2, 0x45, 0x00]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'Media_0x2B6', 500, 5, iStep)

#     @allure.title('Test DTC_Media_TIMEOUT by lost 0x49A message in default session')
#     @allure.description('Test DTC_Media_TIMEOUT by lost 0x49A message in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Media_TIMEOUT_0x49A_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xC2, 0x45, 0x00]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'LTE4G_0x49A', 1000, 5, iStep)

    
#     @allure.title('Test DTC_Media_CRC by 0x49A Checksum Error in default session')
#     @allure.description('Test DTC_Media_CRC by 0x49A Checksum Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Media_CRC_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xC2,0xED,0x83]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#          # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障
#         Driver['CAN'].set_0x49A_checksum_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 10000, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         # 10次 10*1000ms = 10000ms 增加一帧的延时
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 10000, 1)

#         Driver['CAN'].set_0x49A_checksum_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 1000, 1)
#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)

# #     @allure.title('Test DTC_CS_TIMEOUT by lost 0x133 message in default session')
# #     @allure.description('Test DTC_CS_TIMEOUT by lost 0x133 message in default session with physical addressing')
# #     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
# #     def test_DTC_CS_TIMEOUT_0x133_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
# #         DTCNumber = [0xD1, 0x01, 0x87]
# #         iStep = 1
# #         iStep = self.checkDTC(Driver, DTCNumber, 'CS_0x133', 50, 10, iStep)

# #     @allure.title('Test DTC_CS_Signal_Invalid by Turn_Signal_Switch_S out range in default session')
# #     @allure.description('Test DTC_CS_Signal_Invalid by Turn_Signal_Switch_S out range in default session with physical addressing')
# #     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
# #     def test_DTC_CS_Signal_Invalid_TurnSignalSwitchS_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
# #         DTCNumber = [0x5C, 0x5F, 0x86]
# #         iStep = 1
# #         iStep = self.checkDTC(Driver, DTCNumber, 'CS_0x133', 50, 10, iStep, 'Turn_Signal_Switch_S', 0, 1, 'value')

#     @allure.title('Test DTC_VCU_TIMEOUT by lost 0x05A message in default session')
#     @allure.description('Test DTC_VCU_TIMEOUT by lost 0x05A message in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_VCU_TIMEOUT_0x05A_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xD0, 0xC2, 0x86]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'VCU_0x05A', 10, 10, iStep)

#     @allure.title('Test DTC_VCU_TIMEOUT by lost 0x240 message in default session')
#     @allure.description('Test DTC_VCU_TIMEOUT by lost 0x240 message in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_VCU_TIMEOUT_0x240_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xD0, 0xC2, 0x86]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'VCU_0x240', 100, 10, iStep)

#     @allure.title('Test DTC_VCU_CRC by 0x05A Checksum Error in default session')
#     @allure.description('Test DTC_VCU_CRC by 0x05A Checksum Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_VCU_CRC_0x05A_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xD2,0x71,0x83]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障 
#         Driver['CAN'].set_0x05A_checksum_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 100, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 100, 1)

#         Driver['CAN'].set_0x05A_checksum_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 10, 1)

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)

#     @allure.title('Test DTC_VCU_CRC by 0x240 Checksum Error in default session')
#     @allure.description('Test DTC_VCU_CRC by 0x240 Checksum Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_VCU_CRC_0x240_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xD2,0x71,0x83]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障 
#         Driver['CAN'].set_0x240_checksum_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 1000, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 1000, 1)

#         Driver['CAN'].set_0x240_checksum_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)


#     @allure.title('Test DTC_VCU_ALC by 0x05A RollingCounter Error in default session')
#     @allure.description('Test DTC_VCU_ALC by 0x05A RollingCounter Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_VCU_ALC_0x05A_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xD2,0x71,0x82]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)
        
#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障
#         Driver['CAN'].set_0x05A_rolling_counter_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 100, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 100, 1)

#         Driver['CAN'].set_0x05A_rolling_counter_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 10, 1)

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1) 


#     @allure.title('Test DTC_IPB_TIMEOUT by lost 0x10C message in default session')
#     @allure.description('Test DTC_IPB_TIMEOUT by lost 0x10C message in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_IPB_TIMEOUT_0x10C_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xC1, 0x97, 0x80]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'IPB_0x10C', 10, 10, iStep)
  
#     @allure.title('Test DTC_IPB_CRC by 0x10C Checksum Error in default session')
#     @allure.description('Test DTC_IPB_CRC by 0x10C Checksum Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_IPB_CRC_0x10C_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0x5C,0x64,0x62]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)
        
#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障 
#         Driver['CAN'].set_0x10C_checksum_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 100, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 100, 1)
#         # 恢复故障
#         Driver['CAN'].set_0x10C_checksum_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 10, 1)
#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)


#     @allure.title('Test DTC_IPB_ALC by 0x10C RollingCounter Error in default session')
#     @allure.description('Test DTC_IPB_ALC by 0x10C RollingCounter Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_IPB_ALC_0x10C_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0x5C,0x63,0x02]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障 
#         Driver['CAN'].set_0x10C_rolling_counter_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 100, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 100, 1)
#         # 恢复故障
#         Driver['CAN'].set_0x10C_rolling_counter_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 10, 1)
 
#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)


#     ids = ["Request {0}".format(valueName) for valueName, faultValue, realValue in IPB_0x10C_Value]
#     @allure.title(f'Test DTC_IPB_Signal_Invalid by {ids} outrange or invalid in default session')
#     @allure.description(f'Test DTC_IPB_Signal_Invalid by {ids} outrange or invalid in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     @pytest.mark.parametrize('valueName, faultValue, realValue', IPB_0x10C_Value, ids=ids)
#     def test_DTC_IPB_Signal_Invalid_Default_Phy(self, action,BCMPower_Gear, Driver, valueName, faultValue, realValue):
#         DTCNumber = [0x5C, 0x62, 0x86]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'IPB_0x10C', 10, 10, iStep, valueName, faultValue, realValue, 'value')


#     @allure.title('Test DTC_EPS_TIMEOUT by lost 0x06D message in default session')
#     @allure.description('Test DTC_EPS_TIMEOUT by lost 0x06D message in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_EPS_TIMEOUT_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xC1, 0x34, 0x00]
        
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'EPS_0x06D', 10, 10, iStep)

#     @allure.title('Test DTC_EPS_CRCC by 0x06D Checksum Error in default session')
#     @allure.description('Test DTC_EPS_CRC by 0x06D Checksum Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_EPS_CRC_0x06D_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xC4,0x20,0x83]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障
#         Driver['CAN'].set_0x06D_checksum_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 100, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 100, 1)

#         Driver['CAN'].set_0x06D_checksum_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 10, 1)

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)


#     @allure.title('Test DTC_EPS_ALC by 0x06D RollingCounter Error in default session')
#     @allure.description('Test DTC_EPS_ALC by 0x06D RollingCounter Error in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_EPS_ALC_0x06D_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xC4,0x20,0x82]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障 
#         Driver['CAN'].set_0x06D_rolling_counter_error(True)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 100, 1)

#         # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 100, 1)

#         Driver['CAN'].set_0x06D_rolling_counter_error(False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 10, 1)

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)


#     @allure.title('Test DTC_EPS_Signal_Invalid by 0x06D EPS_SteerWheelAg out range in default session')
#     @allure.description('Test DTC_EPS_Signal_Invalid by 0x06D EPS_SteerWheelAg out range in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_EPS_Signal_Invalid_EPSSteerWheelAg_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xD0, 0x17, 0x86]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'EPS_0x06D', 10, 10, iStep, 'EPS_SteerWheelAg', 780, 0, 'value')

#     @allure.title('Test DTC_EPS_Signal_Invalid by 0x06D EPS_SteerWheelAgRat out range in default session')
#     @allure.description('Test DTC_EPS_Signal_Invalid by 0x06D EPS_SteerWheelAgRat out range in default session with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_EPS_Signal_Invalid_EPSSteerWheelAgRat_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#         DTCNumber = [0xD0, 0x17, 0x86]
#         iStep = 1
#         iStep = self.checkDTC(Driver, DTCNumber, 'EPS_0x06D', 10, 10, iStep, 'EPS_SteerWheelAgRat', 1520, 0, 'value')

#     '''空气悬架DTC'''
#     # @allure.title('Test DTC_DiSus_Signal_Invalid by 0x258 DiSus_Height_Not_Calibration_S wrong in default session')
#     # @allure.description('Test DTC_DiSus_Signal_Invalid by 0x258 DiSus_Height_Not_Calibration_S wrong in default session with physical addressing')
#     # @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     # def test_DTC_DiSus_Signal_Invalid_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#     #     DTCNumber = [0xD1, 0x3F, 0x81]
#     #     iStep = 1
#     #     iStep = self.checkDTC(Driver, DTCNumber, 'DiSus_0x258', 100, 10, iStep, 'DiSus_Height_Not_Calibration_S', 1, 0, 'value')

#     # @allure.title('Test DTC_DiSus_ALC by 0x258 RollingCounter Error in default session')
#     # @allure.description('Test DTC_DiSus_ALC by 0x258 RollingCounter Error in default sessionin with physical addressing')
#     # @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     # def test_DTC_DiSus_ALC_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#     #     req = [0x19,0x02,0x09]
#     #     DTC_Number = [0xD0,0xF5,0x82]

#     #     iStep = 1
#     #     iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#     #     iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#     #     # 设置车辆进入极限续航模式，应检测不到DTC
#     #     iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#     #     # 制造故障 
#     #     Driver['CAN'].set_0x258_rolling_counter_error(True)
#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 1000, 1)

#     #     # 设置车辆退出极限续航模式，应检测到DTC
#     #     iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 1000, 1)

#     #     Driver['CAN'].set_0x258_rolling_counter_error(False)
#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#     #     # 重启产品
#     #     iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#     #     iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')
#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)

#     # @allure.title('Test DTC_DiSus_CRC by 0x258 Checksum Error in default session')
#     # @allure.description('Test DTC_DiSus_CRC by 0x258 Checksum Error in default sessionin with physical addressing')
#     # @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     # def test_DTC_DiSus_CRC_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#     #     req = [0x19,0x02,0x09]
#     #     DTC_Number = [0xD1,0x3F,0x83]

#     #     iStep = 1
#     #     iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#     #     iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#     #     # 设置车辆进入极限续航模式，应检测不到DTC
#     #     iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#     #     # 制造故障 
#     #     Driver['CAN'].set_0x258_checksum_error(True)
#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 1000, 1)

#     #     # 设置车辆退出极限续航模式，应检测到DTC
#     #     iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 1000, 1)

#     #     Driver['CAN'].set_0x258_checksum_error(False)
#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#     #     # 重启产品
#     #     iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#     #     iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')
#     #     iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)

#     # @allure.title('Test DTC_DiSus_TIMEOUT by lost 0x258 message in default session')
#     # @allure.description('Test DTC_DiSus_TIMEOUT by lost 0x258 message in default session with physical addressing')
#     # @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     # def test_DTC_DiSus_TIMEOUT_EnduranceMode_Default_Phy(self, action,BCMPower_Gear, Driver):
#     #     DTCNumber = [0xD1, 0x2E, 0x87]
        
#     #     iStep = 1
#     #     iStep = self.checkDTC(Driver, DTCNumber, 'DiSus_0x258', 100, 10, iStep)

    
#     @allure.title('Test power gear is off the failure occurred in default session')
#     @allure.description('Test power gear is off the failure occurred in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_PowerGear_OFF_DTC_EnduranceMode_Default_Phy(self,action,Driver):
#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)
#         Driver['CAN'].write_db_signal(Set_up.NetName, Set_up.nodeName, 'Left_BCM_0x12D', 'BCMPower_Gear_12D_S', 1)
#         time.sleep(3)
#         iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, '1001', '5001', 0, iStep)

#         Driver['CAN'].set_0x06D_rolling_counter_error(True)
#         iStep = self.searchDTC(Driver, [0x19,0x02,0x09], [0xC4,0x20,0x82,0x09], iStep, False, 1000, 1)
#         Driver['CAN'].set_0x06D_rolling_counter_error(False)
#         iStep = self.clearDTC(Driver, iStep)

#     @allure.title('Test power gear is acc the failure occurred in default session')
#     @allure.description('Test power gear is acc the failure occurred in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_PowerGear_ACC_DTC_EnduranceMode_Default_Phy(self,action,Driver):
#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')

#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)
#         Driver['CAN'].write_db_signal(Set_up.NetName, Set_up.nodeName, 'Left_BCM_0x12D', 'BCMPower_Gear_12D_S', 2)
#         time.sleep(3)
#         iStep,uds_resp, size = Driver['CAN'].checkReqResp(Driver, '1001', '5001', 0, iStep)

#         Driver['CAN'].set_0x422_rolling_counter_error(True)
#         iStep = self.searchDTC(Driver, [0x19,0x02,0x09], [0x5C,0x63,0x02,0x09], iStep, False, 1000, 1)
#         Driver['CAN'].set_0x422_rolling_counter_error(False)
#         iStep = self.clearDTC(Driver, iStep)

    
#     @allure.title('Test DTC_Time_SYNC_FAIL by ARS_RDI_TimesynSts in default session')
#     @allure.description('Test DTC_Time_SYNC_FAIL by ARS_RDI_TimesynSts in default sessionin with physical addressing')
#     @allure.testcase('Test cases address:https://chengtech.pingcode.com/testhub/libraries/630357052177ea2394680877/cases')
#     def test_DTC_Time_SYNC_FAIL_EnduranceMode_Default_Phy(self,action,BCMPower_Gear,Driver):
#         req = [0x19,0x02,0x09]
#         DTC_Number = [0xAC,0xEE,0x00]

#         iStep = 1
#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x19,0x02,0x09], [0x59,0x02,0x09], 1, iStep, False, 'UDS', 'ClearFault')
#         iStep = Driver['CAN'].delInitialFailure(iStep,uds_resp)

#         # 开始时间同步
#         tl = TimeSynchron(Driver)
#         logging.info('Waiting 1s for time synchronization complete')
#         time.sleep(1)
#          # 设置车辆进入极限续航模式，应检测不到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, True)
#         # 制造故障 
#         tl.exit = True
#         logging.info('Waiting 5.5s for time synchronization invalidate')
#         time.sleep(5.5)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, False, 100, 1)

#          # 设置车辆退出极限续航模式，应检测到DTC
#         iStep = Driver['CAN'].SetEnduranceMode(Driver,iStep, False)
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x09], iStep, True, 100, 1)
        
#         # 开始时间同步
#         tl = TimeSynchron(Driver)
#         time.sleep(1)
#         logging.info('Waiting 1s for time synchronization complete')
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         # 重启产品
#         iStep = Driver['CAN'].restartMRR_Power(Driver,iStep)

#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, True, 100, 1)

#         iStep,uds_resp,size = Driver['CAN'].checkReqResp(Driver, [0x14,0xFF,0xFF,0xFF], [0x54], 1, iStep, False, 'UDS', 'noClearFault')
#         iStep = self.searchDTC(Driver, req, DTC_Number + [0x08], iStep, False, 100, 1)
#         tl.exit = True